home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-05-24 | 3.1 KB | 113 lines | [TEXT/KAHL] |
- /******************************************************************************
- CAMDialogDirector.c
-
- The AMDialogDirector Class
-
-
- SUPERCLASS = CDialogDirector
-
- ******************************************************************************/
-
- #include <CDialog.h>
- #include <Commands.h>
- #include <Dialogs.h>
- #include "CAMDialogDirector.h"
-
- extern struct CDesktop *gDesktop;
-
- /******************************************************************************
- IAMDialogDirector
-
- Initialize a CAMDialogDirector object
- ******************************************************************************/
-
- void CAMDialogDirector::IAMDialogDirector (short dialogID,
- CDirectorOwner *aSupervisor)
- {
-
- CDialog *itsDialog;
- DialogTHndl dlogTemplateHdl;
- DialogTemplate dt;
-
- inherited::IDialogDirector (aSupervisor);
- hasBegun = FALSE;
-
- itsDialog = new CDialog;
- itsWindow = itsDialog;
-
- dlogTemplateHdl = (DialogTHndl) GetResource( 'DLOG', dialogID);
- FailNILRes(dlogTemplateHdl);
- dt = **dlogTemplateHdl;
-
- // make a floating window iff procID = 3200, i.e. WDEF ID = 200
- itsDialog->INewWindow (&dt.boundsRect, FALSE, dt.procID, (dt.procID==3200),
- dt.goAwayFlag, gDesktop, this);
- itsDialog->IDialogX();
-
- itsDialog->SetTitle(dt.title);
-
- } /* IAMDialogDirector */
-
- /******************************************************************************
- BeginDialog
-
- Set hasBegun true.
- This is used to support modeless dialogs which may not be visible when created.
- We create all modeless dialogs at App initialization time. We don't call BeginDialog
- because that would make the dialog visible. If the dialog has its visible bit set, its
- window will be Selected, which through a sequence of events will eventually call
- ActivateWind. If it sees that BeginDialog has not been called then it calls it.
- (Are there enough “it”s in the previous sentence?)
-
- ******************************************************************************/
- void CAMDialogDirector::BeginDialog (void)
- {
- inherited::BeginDialog ();
- hasBegun = TRUE;
-
- } /* BeginDialog */
-
- /******************************************************************************
- ActivateWind
-
- Window owned by this Director has been activated
- If BeginDialog has not been called, then call it now.
-
- ******************************************************************************/
- void CAMDialogDirector::ActivateWind (CWindow *theWindow)
- {
- if (!hasBegun) {
- BeginDialog ();
- }
- inherited::ActivateWind (theWindow);
- } /* ActivateWind */
-
- /******************************************************************************
- CloseWind
-
- ******************************************************************************/
- void CAMDialogDirector::CloseWind (CWindow *theWindow)
- {
- theWindow->Hide ();
- } /* CloseWind */
-
-
- /******************************************************************************
- DoCommand
-
- ******************************************************************************/
- void CAMDialogDirector::DoCommand (long theCommand)
- {
- switch (theCommand) {
- case cmdClose:
- CloseWind (itsWindow);
- break;
- default:
- inherited::DoCommand (theCommand);
- break;
- } /* switch */
-
- } /* DoCommand */
-
- /* CAMDialogDirector */
-